package com.hmeter.util;

import java.awt.Checkbox;
import java.awt.Component;

import javax.swing.JPanel;

public class BooleanPropertyEditor extends org.apache.jmeter.testbeans.gui.BooleanPropertyEditor {

	private Checkbox box;

	public BooleanPropertyEditor() {
		box = new Checkbox();
	}

	@Override
	public Component getCustomEditor() {
		JPanel panel = new JPanel();
		panel.add(box);
		return panel;
	}

	@Override
	public boolean supportsCustomEditor() {
		return true;
	}

	@Override
	public void setValue(Object value) {
		box.setState(value != null ? value.toString().equalsIgnoreCase("true") : false);
	}

	@Override
	public String getAsText() {
		return String.valueOf(box.getState());
	}
	
	
	@Override
	public Object getValue() {
		return String.valueOf(box.getState());
	}
	
}
